GuiRenderer = class()

function GuiRenderer:init()
    self.bar = Bar()
    self.barTool = BarTool()
    self.backBag = BackBag()
    self.pauseMenu = Pause()
    self.touchPoint = TouchPoint()
    self.debugs = Debug(false)
    self.pauseButton = TextButton(WIDTH - 45,HEIGHT - 20,LP.pause)
    self.pauseButton:setFont("HelveticaNeue-Light",40)
    self.pauseButton.fontSize = 25
    self.pauseButton.clicked = function() self.pauseMenu:pause() end
    self.pauseButton.backColor = color(0, 26, 251, 0)
    self.pauseButton.textColor = color(255,255,255,255)
end

function GuiRenderer:draw()
    resetMatrix()
    self.bar:draw()
    self.barTool:draw()
    self.backBag:draw()
    self.pauseButton:draw()
    if GameState.State == Pause then
        self.pauseMenu:draw()
    else
        self.debugs:draw()
        game.move:draw()
        self.touchPoint:draw()
    end
end

function GuiRenderer:touched(touch)
    if GameState.State == Pause then
        self.pauseMenu:touched(touch)
        return true
    end
    
    if self.backBag:touched(touch) then return true end
    if self.bar:touched(touch) then return true end
    if self.barTool:touched(touch) then return true end
    if self.pauseButton:touched(touch) then return true end
    
    if self.touchPoint:touched(touch) then return true end
end
